package com.huijiet.controller;

import com.huijiet.service.INewsService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;

@Controller
public class WebController {

    @Resource
    private INewsService newsService;

    //首页
    @RequestMapping({"/", "/index.html"})
    public String index(){
        return "/index";
    }

    //产品服务
    @RequestMapping("/product.html")
    public String product(){
        return "/product";
    }

    //产品服务-通关
    @RequestMapping("/tariffs.html")
    public String tariffs(){
        return "/tariffs";
    }


    //产品服务-仓储
    @RequestMapping("/logistics.html")
    public String logistics(){
        return "/logistics";
    }


    //产品服务-金融
    @RequestMapping("/financial.html")
    public String financial(){
        return "/financial";
    }


    //产品服务-进口
    @RequestMapping("/entrance.html")
    public String entrance(){
        return "/entrance";
    }


    //产品服务-增值
    @RequestMapping("/appreciation.html")
    public String appreciation(){
        return "/appreciation";
    }

    //关于我们-简介
    @RequestMapping("/about.html")
    public String about(){
        return "/about";
    }

    //关于我们-发展
    @RequestMapping("/history.html")
    public String history(){
        return "/history";
    }

    //关于我们-联系我们
    @RequestMapping("/contact.html")
    public String contact(){
        return "/contact";
    }


    //新闻-贸易资讯
    @RequestMapping("/news.html")
    public String news(){
        return "/news";
    }

    //新闻-公司动态
    @RequestMapping("/company.html")
    public String company(){
        return "/company";
    }

    //新闻详情
    @RequestMapping("/details.html-{newsId}")
    public String details(@PathVariable("newsId")Integer newsId){

        newsService.detail(newsId);
        return "/details";
    }

    //后台管理
    @RequestMapping("/houtai")
    public String houtai(){
        return "redirect:/dist/index.html";
    }
}
